<?php
	require('conn.cfg.php');
	require('functions.php');		
	
    $productid = 1;
	if($_REQUEST['command']=='add' && $_REQUEST['productid']>0){
		$pid=$_REQUEST['productid'];
                $qty=$_REQUEST['qty'];
		addtocart($pid, $qty);
		header("location:x2cart.php");
		exit();
	}else if($_REQUEST['command']=='view' && $_REQUEST['pid']>0){
		$productid = $_REQUEST['pid'];                
	}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>X2PERFORMANCE :: Products</title>
<link rel="stylesheet" href="assets/css/reset.css" />
<link rel="stylesheet" href="assets/css/text.css" />
<link rel="stylesheet" href="assets/css/960.css" />
<link rel="stylesheet" href="assets/css/style.css" />
<link rel="SHORTCUT ICON" href="favicon.ico"/>
<script type="text/javascript" src="assets/js/jquery-1.5.2.min.js"></script>
<script type="text/javascript" src="assets/js/kickstart.js"></script>
<script type="text/javascript" src="assets/js/script00.js"></script>
<script type="text/javascript" src="assets/js/skimlink.js"></script>
<script type="text/javascript" src="assets/js/jquery.cycle.js"></script>
<script type="text/javascript" src="assets/js/slideshow.js"></script>
<link rel="stylesheet" href="assets/css/coda-slider.css" type="text/css" media="screen" title="no title" charset="utf-8">
<script src="assets/js/jquery_002.js" type="text/javascript"></script>
<script src="assets/js/jquery_003.js" type="text/javascript" charset="utf-8"></script>
<script src="assets/js/jquery.js" type="text/javascript" charset="utf-8"></script>
<!--<script src="assets/js/coda-slider.js" type="text/javascript" charset="utf-8"></script>-->

<!--[if IE 7]>
	<style>
    #bottle{ margin-left:-335px;}
    #nav {height:45px;}
    #nav li { display: inline;margin-bottom:8px;}
    </style>
<![endif]-->
<!-- CuFon: Enables smooth pretty custom font rendering. 100% SEO friendly. To disable, remove this section -->
<script type="text/javascript" src="assets/js/cufon-yui.js"></script>
<script type="text/javascript" src="assets/js/PT_Sans_400-PT_Sans_700-PT_Sans_italic_400-PT_Sans_italic_700.font.js"></script>
<script type="text/javascript" src="assets/js/cuf_run.js"></script>
<!-- CuFon ends -->
</head>
<body>
<form name="form1">
    <input type="hidden" name="productid" />
    <input type="hidden" name="qty" />
    <input type="hidden" name="discount" />
    <input type="hidden" name="command" />
</form>    
<div  id="header">
  <div class="container_16">
    <noscript>
    <div class="alert"> In order to be able to view this website, Javascript needs to be active in your web browser. </div>
    </noscript>
    <div class="grid_8"> <a id="logo" href="index.html" title="X2 Performance"></a> </div>
    <div class="grid_3"> <a id="nsf" href="http://nsfsport.com/listings/certified_detail.asp?id=707999" title="NSF Certified for Sport" target="_blank"></a> </div>
    <div class="grid_5" id="topnavigation">
      <ul id="topnav">
        <!--<li><a href="">Login</a></li>
         <li><a>|</a></li>
        <li><a href="">Register</a></li>-->
        <li><span class="viewcart"></span><a href="free_trial.html">View cart</a></li>
      </ul>
    </div>
    <div class="clear"></div>
    <div class="grid_16" id="navigation">
      <ul id="nav">
        <li><a href="index.html" class="home">Home</a></li>
        <li><a href="about_us.html" class="aboutcompany">About Us</a></li>
        <li class="current_page_item current_page"><a href="services.html" class="x2performanceactive">X<sup>2</sup>PERFORMANCE</a></li>
        <li><a href="sport.html" class="sportcertified">sportcertified</a></li>
        <li><a href="contact_us.html" class="contact">Contact Us</a></li>
        <li><a href="blog.html" class="blog">Blog</a></li>
      </ul>
      <!--ul class="order">
        <li><a href="order_now.html" class="ordernow">Order now</a></li>
      </ul-->
    </div>
  </div>
</div>
<div class="container_16">
  <div class="grid_16 innerheader">
    <div class="innerheaderbg"></div>
    <h2>OUR PRODUCTS</h2>
  </div>
  <div class="clear"></div>  
  <div id="productGrid">        
   <div id="contentProductDetail">
<?php
    if (is_numeric($productid) && $productid > 0){
        /* retrieve product information*/
        $result = mysql_query("SELECT id, product_name, short_desc, price, full_desc, big_img_url FROM x2_products WHERE product_type=1 and ID=".$productid);
        if ($row = mysql_fetch_assoc($result)) {
?>       
<script type="text/javascript">
    function addtoSomeWhere(pid) {     
        var qty = jQuery('#quantity').val();
        
        if(isNaN(qty)){                     
            alert('Please correct the quantity');            
        }else{
            document.form1.productid.value = pid;
            document.form1.qty.value = qty;
            document.form1.command.value = 'add';
            document.form1.submit();
        }
    }

</script>       
  <img class="productLarge" src="<?=$row['big_img_url']?>"/>	
    <div id="productDetails">
    <h1><?=$row['product_name']?></h1>
    <input type="hidden" value="<?=$row['price']?>" id="productPrice">
    <p style="margin-top:10px;"><b><?=$row['short_desc']?></b></p> 
    <p class="productDescriptionShort">$<b><?=$row['price']?>*</b> + shipping &amp; handling</p>
	<table class="productTable">
        <tbody><tr>
            <td><span class="optionLabel">Quantity</span></td>
            <td>
                <input type="text" value="1" name="quantity" id="quantity" class="productQty">
            </td>
        </tr>
        <tr bgcolor="#FFF">
            <td colspan="2">
                <a onclick="addtoSomeWhere(<?=$row['id']?>)" class="cartButton">Add to Cart</a>
            </td>
        </tr>
    </tbody></table>
</div>
    <div id="productDescription">
        <p><b><?=$row['full_desc']?> made within 90 days of this <?=$row['product_name']?> purchase</b></p>                
    </div>         
<?php 
        }else{
            /* not found, do nothing*/
        }
} ?>         	
</div>
   </div>
 
</div>
<br clear="all">
<div id="footer">
  <div class="container_16">
    <div id="footersectionone">
      <div class="grid_1">
        <h3><a href="index.html">Home</a></h3>
      </div>
      <div class="grid_3 footermenucontainer">
        <h3><a href="about_us.html">About Us</a></h3>
        <ul class="mainlinks">
          <li><a href="about_us.html#ceomessage">CEO Message</a></li>
        </ul>
      </div>
      <div class="grid_3 footermenucontainer">
        <h3><a href="services.html">X<sup>2</sup>PERFORMANCE</a></h3>
        <ul class="mainlinks">
          <li><a href="services.html#science">Science</a></li>
          <li><a href="supplymentfacts.html">Supplement facts</a></li>
          <li><a href="instruction.html">Instructions</a></li>
          <li><a href="pricing.html">Pricing</a></li>
          <li><a href="testimonial.php">Testimonials</a></li>
        </ul>
      </div>
      
      <div class="grid_2">
        <h3><a href="contact_us.html">Contact Us</a></h3>
        <ul class="mainlinks">
          <li><a href="privacy.html">Privacy Policy</a></li>
          <li><a href="terms.html">Terms</a></li>
        </ul>
      </div>
      <div class="grid_2">
        <h3><a href="sport.html">Sport certified</a></h3>
      </div>
      <div class="grid_1">
        <h3><a href="blog.html">Blog</a></h3>
      </div>
      <div class="grid_5" id="socialicons">
        <h3>CONNECT WITH US</h3>
        <a id="twitter" href="http://twitter.com/#!/x2performance" title="Twitter" target="_blank"></a> <a id="facebook" href="http://www.facebook.com/X2PERFORMANCE" title="Facebook" target="_blank"></a> <a id="youtube" href="http://www.youtube.com/user/TEAMX2PERFORMANCE/featured" title="You Tube" target="_blank"></a> <a id="googleplus" href="https://plus.google.com/109519688499936342953/posts" title="Google Plus" target="_blank"></a> </div>
      <div class="clear"></div>
    </div>
    <div id="footersectiontwo"> <span id="footerlogo"></span>
      <h3><span>MAKE IT HAPPEN <sup>®</sup></span><br/>
        PROUDLY MADE IN THE USA &copy; 2012 Advanced Bio Development LLC</h3>
      <span id="footerlogo2"></span> </div>
  </div>
 
</div>
<script type="text/javascript" src="assets/js/menu.js"></script>
</body>
</html>